<?php defined('KX_ROOT') || exit('Permission denied');?><!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8" name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
    <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
    <title>我的书单 - <?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "sitename");?></title>
    <meta name="keywords" content="<?php include \Kuxin\View::parseTpl($tkd['keywords']);?>">
    <meta name="description" content="<?php include \Kuxin\View::parseTpl($tkd['description']);?>">
	<link rel="stylesheet" href="<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/css/global.css"/>
	<script src="<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/js/flexible.min.js"></script>
    <link rel="shortcut icon" type="image/ico" href="/favicon.ico" />
    <meta name="author" content="www.ptcms.com">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width" />
    <meta name="applicable-device" content="pc">
    <meta http-equiv="mobile-agent" content="format=html5; url=<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "mobileurl");?><?php echo $_SERVER['REQUEST_URI'];?>">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <meta http-equiv="Cache-Control" content="no-transform" />
    <link rel="canonical" href="<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "pcurl");?><?php echo $_SERVER['REQUEST_URI'];?>" />
    <style>
        html,body{
            height: 100%;
        }
        .loading{
            position: fixed;
            left: 0;
            top:0;
            width: 100%;
            height: 100%;
            z-index: 100;
            background-color: rgba(0,0,0,0.5) !important;
            background: url("<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/images/loading.webp") no-repeat;
            background-position: 50% 50%;
            background-size: 32px 32px;
        }
        .pt-popular-cont{
            display: none;
            /*min-height: 100%;*/
            width: 100%;
            height: auto;
        }
        .pt-popular-cont.active{
            display: block;
        }
        .btn-tag img{
            width: .16rem;
            height: .16rem;
            transform:rotate(180deg);
            float: right;
        }

        .pt-tags{
            position: relative;
        }
        .pt-tags ul{
            margin-bottom: 60px;
        }
        .pt-tags li{
            display: inline-block;
            padding: 2px 15px;
            border: 1px solid #d5d5d5;
            border-radius:20px;
            margin: 5px 0 15px 0;
        }
        .pt-tags li.active{
            background-color: #f55;
            color: #fff;
            border-color: #f55;
        }
        .pt-tags button,
        .pt-novel button,
        .pt-marks button,
        .pt-search button{
            box-shadow:0 0 16px 0 rgba(255,85,85,0.92);
            border-radius:44px;
        }
        .pt-tags .btn,
        .pt-novel .btn,
        .pt-marks .btn,
        .pt-search .btn{
            position: fixed;
            bottom: 0;
            left: 0;
            background-color: #fff;
            width: 100%;
        }
        .pt-novel ul .pt-novel-del{
            height: 16px;
            width: 16px;
            float: right;
            background: url("<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/images/del.png") no-repeat;
            -webkit-background-size: 100% 100%;
            background-size: 100% 100%;
        }
        .pt-novel-comment{
            height:63px;
            border:1px solid #E9E9E9;
        }
        .pt-novel-select{
            margin-top: 0.35rem;
            width: 0.16rem;
            height: 0.16rem;
            background: url('<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/images/select.png') no-repeat;
            -webkit-background-size: 100% 100% !important;
            background-size: 100% 100% !important;
        }
        li.active .pt-novel-select{
            background: url('<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/images/selected.png') no-repeat;
        }
        .pt-square{
            margin-left: 0;
            margin-right: 0;
        }
        .pt-square.active{
            border-color: #f55;
            background-color: #f55;
            color: #fff;
        }
    </style>
</head>
<body>
    <?php $info=\Kuxin\Block::show('booklist.info', ['booklistid'=>$_GET['id']]);?>
	<div class="w100  bg-white flex-wrp flex-align-center flex-between lh100 plr15 ptb15">
		<img src="<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/images/return.png" class="pt-return">
		<div class="size14 bold color89 pt-labs"><?php echo empty($info)?'创建书单':'修改书单';?></div>
        <div><button type="button" class="color2 bold size14 btn-next bg-white">下一步</button></div>
	</div>
    <form method="post">
        <?php if(!empty($info)):?>
        <input type="hidden" name="id" value="<?php echo $info['id'];?>">
        <?php endif;?>
        <div data-page="edit" class="pt-popular-cont pt-edit active" style="min-height: 100%">
            <input class="bold size18 mt10 mb20 w100" type="text" name="title" placeholder="请输入书单名称" value="<?php echo $info['title'];?>">
            <div class="border-b size14 ptb10 btn-tag">
                <select name="tags[]" class="none" multiple>
                    <?php if(is_array($info['tags'])): foreach($info['tags'] as $key =>$loop):?>
                    <option value="<?php echo $loop['id'];?>" selected><?php echo $loop['name'];?></option>
                    <?php endforeach; endif;?>
                </select>
                <input type="text" value="<?php echo empty($info['tags'])?'':join(',',array_column($info['tags'],'name'));?>" placeholder="请选择书单标签" readonly>
                <img src="<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/images/return.png">
            </div>
            <textarea class="size14 pt10 w100" name="intro" rows="6" placeholder="请输入书单简介"><?php echo $info['intro'];?></textarea>
        </div>
        <div data-page="tags" class="pt-popular-cont pt-tags">
            <?php  $tags=array_column($info['tags'],'id');?>
            <?php $list=\Kuxin\Block::show('tag', []);?>
            <span class="color32 size18 bold">全部标签</span>
            <ul>
                <?php if(is_array($list)): foreach($list as $key =>$loop):?>
                <li data-value="<?php echo $loop['id'];?>" data-name="<?php echo $loop['name'];?>" class="<?php echo in_array($loop['id'],$tags)?'active':'';?>"><?php echo $loop['name'];?></li>
                <?php endforeach; endif;?>
            </ul>
            <div class="text-center ptb10 btn">
                <button type="button" class="color1 bg-red ptb15 plr60 size16 bold mtb10">确认选择</button>
            </div>
        </div>
        <div data-page="novel" class="pt-popular-cont pt-novel">
            <div class="pt-booklist-title size16 color32 bold mt10">标题</div>
            <div class="pt-booklist-tags size12 color32 mt10">标签</div>
            <div class="compulsory-row w100 color32 size12 pt-booklist-intro mt10 border-t pt5" style="height: 84px;"></div>
        </div>
        <div data-page="novel" class="pt-popular-cont pt-novel mt10">
            <ul>
                <?php if(is_array($info['novels'])): foreach($info['novels'] as $key =>$loop):?>
                <li>
                    <div class="flex-wrp pt-popular-item">
                        <input type="hidden" name="novels[id][]" value="<?php echo $loop['novel']['id'];?>">
                        <input type="hidden" name="novels[star][]" value="<?php echo $loop['star'];?>">
                        <img src="<?php echo $loop['novel']['cover'];?>" class="mr15" alt="<?php echo $loop['novel']['name'];?>">
                        <div class="flex-item pt5">
                            <div class="flex-wrp flex-between">
                                <div class="size14">
                                    <span class="color7 bold"><?php echo $loop['novel']['name'];?></span>
                                </div>
                                <div class="pt-novel-del"></div>
                            </div>
                            <div class="size12">
                                <span class="mr30"><?php echo $loop['author']['name'];?></span>
                                <?php echo $loop['category']['name'];?> | <span class="color2"><?php echo $loop['data']['allvisit'];?></span>人在读
                            </div>
                            <div class="mt10">
                                <span class="color32 size14">推荐指数</span>
                                <span class="pt-photo">
                                <span title="不知所云">
                                    <img src="<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/images/star<?php echo $loop['star']>=1?'1':'';?>.png" class="<?php echo $loop['star']>=1?'':'no';?>high">
                                </span>
                                <span title="随便看看">
                                    <img src="<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/images/star<?php echo $loop['star']>=2?'1':'';?>.png" class="<?php echo $loop['star']>=2?'':'no';?>high">
                                </span>
                                <span title="值得一读">
                                    <img src="<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/images/star<?php echo $loop['star']>=3?'1':'';?>.png" class="<?php echo $loop['star']>=3?'':'no';?>high">
                                </span>
                                <span title="不容错过">
                                    <img src="<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/images/star<?php echo $loop['star']>=4?'1':'';?>.png" class="<?php echo $loop['star']>=4?'':'no';?>high">
                                </span>
                                <span title="经典必读">
                                    <img src="<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/images/star<?php echo $loop['star']>=5?'1':'';?>.png" class="<?php echo $loop['star']>=5?'':'no';?>high">
                                </span>
                            </span>
                            </div>
                        </div>
                    </div>
                    <textarea class="pt-novel-comment compulsory-row plr10 ptb10 w100" name="novels[comment][]" readonly><?php echo $loop['comment'];?></textarea>
                </li>
                <?php endforeach; endif;?>
            </ul>
            <div class="text-center ptb10 btn">
                <button type="button" class="color1 bg-red ptb10 plr35 size16 bold mtb10 mr20 pt-mark-add">书架添加</button>
                <button type="button" class="color1 bg-red ptb10 plr35 size16 bold mtb10 pt-search-add">书城添加</button>
            </div>
        </div>
        <div data-page="marks" class="pt-popular-cont pt-marks">
            <ul>
                <?php $marklist=\Kuxin\Block::show('mark.list', ['userid'=>$userinfo['id'],'order'=>$order]);?>
                <?php if(is_array($marklist)): foreach($marklist as $key =>$loop):?>
                <li data-id="<?php echo $loop['novel']['id'];?>" data-name="<?php echo $loop['novel']['name'];?>" data-cover="<?php echo $loop['novel']['cover'];?>" data-author="<?php echo $loop['author']['name'];?>" data-category="<?php echo $loop['category']['name'];?>" data-allvisit="<?php echo $loop['data']['allvisit'];?>">
                    <div class="flex-wrp pt-popular-item">
                        <img src="<?php echo $loop['novel']['cover'];?>" class="mr15" alt="<?php echo $loop['novel']['name'];?>">
                        <div class="flex-item pt5">
                            <div class="flex-wrp flex-between">
                                <div class="size14">
                                    <span class="color7 bold"><?php echo $loop['novel']['name'];?></span>
                                </div>
                            </div>
                            <div class="size12">
                                <span class="mr30"><?php echo $loop['author']['name'];?></span>
                                <?php echo $loop['category']['name'];?>
                            </div>
                            <div class="mt10 size12"><?php echo $loop['last']['name'];?></div>
                        </div>
                        <div class="pt-novel-select"></div>
                    </div>
                </li>
                <?php endforeach; endif;?>
            </ul>
            <div class="text-center ptb10 btn">
                <button type="button" class="color2 bg-white border-red ptb10 plr35 size16 bold mtb10 mr20">取消返回</button>
                <button type="button" class="color1 bg-red ptb10 plr35 size16 bold mtb10 btn-success">完成添加 (<span>0</span>)</button>
            </div>
        </div>
        <div data-page="search" class="pt-popular-cont pt-search">
            <div class="w100 bg-white flex-wrp flex-between flex-align-center pt-search">
                <div class="flex-wrp flex-align-center pt-search-box" style="width: 80vw;">
                    <img src="<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/images/search.png" class="mr10 pt-search-icon" >
                    <input type="text" class="size12 color4 searchkey w100" placeholder="请输入您要搜索的关键书名">
                </div>
                <div class="btn-search color2 size14 mr5">搜索</div>
            </div>
            <ul></ul>
            <div class="clearfix"></div>
            <div class="text-center ptb10 btn">
                <button type="button" class="color2 bg-white border-red ptb10 plr35 size16 bold mtb10 mr20">取消返回</button>
                <button type="button" class="color1 bg-red ptb10 plr35 size16 bold mtb10 btn-success">完成添加 (<span>0</span>)</button>
            </div>
        </div>
    </form>
    <!-- 底部版权 -->
    <div class="pt-copyright">
    <div class="size12  w100 text-center mt15 mb10"><a title="隐私声明" href="<?php echo \Kuxin\Helper\Url::build("page.detail",['key'=>'privacy'],"");?>" class="color4">隐私声明</a> | <a title="免责声明" href="<?php echo \Kuxin\Helper\Url::build("page.detail",['key'=>'disdaimer'],"");?>" class="color4">免责声明</a> | <a title="关于我们" href="<?php echo \Kuxin\Helper\Url::build("page.detail",['key'=>'about'],"");?>" class="color4">关于我们</a></div>
    <div class="size12 color4 w100 text-center mb10">Copyright © 2009-<?php echo date(Y);?> <?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "beian");?></div>
    <div class="size12  w100 text-center"><?php echo \Kuxin\Response::runinfo();?></div>
</div>
<!-- js -->
<script src="<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/js/jquery-3.3.1.js"></script>
<script>
    $('.pt-return,.pt-recall').click(function(){
        window.history.back();
    });
    $('.pt-ellipsis').click(function(){
        $('.pt-tip').toggle()
    });
    $('.pt-tip .pt-tip-item').click(function(){
        $('.pt-tip').toggle()
    });
</script>
<div class="none">
    <?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "tongji.mobile");?>
    <?php if(\Kuxin\Helper\Arr::getValue($_kxcms_config, "app.use_cdn")):?>
    <script src="/api/stat/novel/info.js"></script>
    <script src="/api/stat/novel/read.js"></script>
    <?php endif;?>
</div>
    <script id="searchTpl" type="text/html">
        {{# $.each(d,function(k,v){ }}
        <li data-id="{{v.id}}" data-name="{{v.name}}" data-cover="{{v.cover}}" data-author="{{v.author}}" data-category="{{v.category}}" data-allvisit="{{v.allvisit}}">
            <div class="flex-wrp pt-popular-item">
                <img src="{{ v.cover }}" class="mr15" alt="{{ v.name }}">
                <div class="flex-item pt5">
                    <div class="flex-wrp flex-between">
                        <div class="size14"><span class="color7 bold">{{ v.name }}</span></div>
                    </div>
                    <div class="size12">
                        <span class="mr30"{{ v.author }}</span>
                        <span>{{ v.category }}</span> | <span class="color2">{{ v.allvisit }}</span>人在读
                    </div>
                    <div class="mt10 size12">{{ v.last.name }}</div>
                </div>
                <div class="pt-novel-select"></div>
            </div>
        </li>
        {{# }) }}
    </script>
    <script id="novelTpl" type="text/html">
        <li>
            <div class="flex-wrp pt-popular-item">
                <input type="hidden" name="novels[id][]" value="{{d.id}}">
                <input type="hidden" name="novels[star][]" value="5">
                <img src="{{d.cover}}" class="mr15" alt="{{d.name}}">
                <div class="flex-item pt5">
                    <div class="flex-wrp flex-between">
                        <div class="size14">
                            <span class="color7 bold">{{d.name}}</span>
                        </div>
                        <div class="pt-novel-del"></div>
                    </div>
                    <div class="size12">
                        <span class="mr30">{{d.author}}</span> {{d.category}} | <span class="color2">{{d.allvisit}}</span>人在读
                    </div>
                    <div class="mt10">
                        <span class="color32 size14">推荐指数</span>
                        <span class="pt-photo">
                                <span title="不知所云">
                                    <img src="<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/images/star1.png" class="high">
                                </span>
                                <span title="随便看看">
                                    <img src="<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/images/star1.png" class="high">
                                </span>
                                <span title="值得一读">
                                    <img src="<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/images/star1.png" class="high">
                                </span>
                                <span title="不容错过">
                                    <img src="<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/images/star1.png" class="high">
                                </span>
                                <span title="经典必读">
                                    <img src="<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/images/star1.png" class="high">
                                </span>
                            </span>
                    </div>
                </div>
            </div>
            <textarea class="pt-novel-comment compulsory-row plr10 ptb10 w100" name="novels[comment][]" readonly></textarea>

        </li>
    </script>
    <script id="novelEditTpl" type="text/html">
        <div class="flex-wrp flex-flow-row flex-around plr10 mt10">
            <div class="flex-wrp flex-center color62 size12 mb15 pt-square {{d.star==1?'active':''}}" data-value="1"><span class="size14">1</span>分</div>
            <div class="flex-wrp flex-center color62 size12 mb15 pt-square {{d.star==2?'active':''}}" data-value="2"><span class="size14">2</span>分</div>
            <div class="flex-wrp flex-center color62 size12 mb15 pt-square {{d.star==3?'active':''}}" data-value="3"><span class="size14">3</span>分</div>
            <div class="flex-wrp flex-center color62 size12 mb15 pt-square {{d.star==4?'active':''}}" data-value="4"><span class="size14">4</span>分</div>
            <div class="flex-wrp flex-center color62 size12 mb15 pt-square {{d.star==5?'active':''}}" data-value="5"><span class="size14">5</span>分</div>
        </div>
        <div style="text-align: center;">
            <textarea rows="5" class="border-c9" style="width: 90%;padding: 5px;" placeholder="请输入评价">{{d.comment}}</textarea>
        </div>
        <div class="flex-wrp flex-center size14 ptb10 bg-red color1 pt-submit w50 mt10" style="margin: auto;border-radius: 20px;">确认提交</div>
    </script>
    <script src="<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/js/layer/mobile/layer.js"></script>
    <script src="<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/js/laytpl.js"></script>
    <script>
        var btn_next = $('.btn-next'),
            btn_return = $('.pt-return'),
            pt_edit = $('.pt-popular-cont.pt-edit'),
            pt_tags = $('.pt-popular-cont.pt-tags'),
            pt_novel = $('.pt-popular-cont.pt-novel'),
            pt_marks = $('.pt-popular-cont.pt-marks'),
            pt_search = $('.pt-popular-cont.pt-search');
        //返回按钮事件
        btn_return.off('click').click(function () {
            switch ($('.pt-popular-cont.active').data('page')) {
                case 'edit':
                    if (confirm('确认离开此页?')) {
                        window.history.back();
                    }
                    break;
                case 'tags':
                    $('.pt-tags button').click();
                    break;
                case 'novel':
                    pt_novel.removeClass('active');
                    pt_edit.addClass('active');
                    btn_next.text('下一步');
                    break;
                case 'marks':
                    pt_novel.addClass('active');
                    pt_marks.removeClass('active');
                    btn_next.show();
                    break;
                case 'search':
                    pt_novel.addClass('active');
                    pt_search.removeClass('active');
                    btn_next.show();
                    break;

            }
        });
        //下一步按钮事件
        btn_next.click(function(){
            if ($('.pt-popular-cont.active').data('page') === 'edit'){
                if (!($('input[name=title]').val())) {
                    layer.open({content:'标题不能为空',btn:'我知道了'});
                    return false;
                }
                if ($('select[name="tags[]"]').val().length > 3) {
                    layer.open({content:'标签不能多于3个',btn:'我知道了'});
                    return false;
                }
                this.innerHTML = '发布';
                pt_edit.removeClass('active');
                pt_novel.addClass('active');
                $('.pt-booklist-title').html($('input[name=title]').val());
                $('.pt-booklist-tags').html($('.pt-popular-cont.pt-edit .btn-tag input').val());
                $('.pt-booklist-intro').html($('textarea[name=intro]').val());
            }else{
                if (!($('input[name=title]').val())) {
                    layer.open({content:'书单名称不能为空',btn:'我知道了'});
                    return false;
                }
                if ($('select[name="tags[]"]').val().length > 3) {
                    layer.open({content:'标签不能多于3个',btn:'我知道了'});
                    return false;
                }
                if (!$('textarea[name=intro]').val().length) {
                    layer.open({content:'简介不能为空',btn:'我知道了'});
                    return false;
                }
                if ($('input[name="novels[id][]"]').length < 3) {
                    layer.open({content:'书籍不能少于三本',btn:'我知道了'});
                    return false;
                }
                for (var i = 0; i < $('input[name="novels[id][]"]').length; i++) {
                    if (!$('textarea[name="novels[comment][]"]:eq(' + i + ')').val()) {
                        layer.open({content:'书评不能为空',btn:'我知道了'});
                        return false;
                    }
                    star = parseInt($('input[name="novels[star][]"]:eq(' + i + ')').val());
                    if (!star || star < 1 || star > 5) {
                        layer.open({content:'评分必须介于1 - 5之间',btn:'我知道了'});
                        return false;
                    }
                }
                $('form').submit();
            }
        });
        //选择标签事件
        $('.btn-tag').click(function () {
            $(this).parent().removeClass('active');
            pt_tags.addClass('active');
            btn_next.hide();
        });
        //选择标签页面确认按钮事件
        $('.pt-tags button').click(function () {
            $(this).parents('.pt-popular-cont').removeClass('active');
            pt_edit.addClass('active');
            var lis = $('.pt-tags li.active'),
                select = $('.pt-popular-cont.pt-edit .btn-tag select'),
                names = [];
            select.html('');
            for (i = 0; i < lis.length; i++) {
                names.push(lis.eq(i).data('name'));
                select.append('<option value="' + lis.eq(i).data('value') + '" selected></option>');
            }
            $('.pt-popular-cont.pt-edit .btn-tag input').val(names.length ? names.join(',') : '');
            btn_next.show();
        });
        // 选择标签页面标签点击事件
        $('.pt-tags li').click(function () {
            if ($(this).hasClass('active')) {
                $(this).removeClass('active');
            } else {
                if ($('.pt-tags li.active').length >= 3) {
                    alert('最多只能选择三个标签');
                    return false;
                }
                $(this).addClass('active');
            }
        });

        //书籍页 移除书籍
        pt_novel.on('click', 'textarea,.pt-photo', function () {
            var othis = $(this).parents('li');
            laytpl($('#novelEditTpl').html()).render({
                star:parseInt(othis.find('input[name="novels[star][]"]').val()),
                comment:othis.find('textarea[name="novels[comment][]"]').val()
            }, function (html) {
                var index = layer.open({
                    type: 1,
                    content: html,
                    anim: 'up',
                    style: 'position:fixed; bottom:0; left:0; width: 100%; height: 200px; padding:10px 0; border:none;',
                    success: function (obj) {
                        $(obj).on('click', '.pt-square', function () {
                            $(this).addClass('active').siblings('.active').removeClass('active');
                        }).on('click', '.pt-submit', function () {
                            var star = $(obj).find('.pt-square.active').data('value'),
                                comment = $(obj).find('textarea').val();
                            othis.find('input[name="novels[star][]"]').val(star);
                            othis.find('textarea[name="novels[comment][]"]').val(comment);
                            othis.find('.pt-photo img').attr('src', '<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/images/star.png');
                            othis.find('.pt-photo img:lt(' + star + ')').attr('src', '<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/images/star1.png');
                            layer.close(index)
                        })
                    }
                })
            });
        }).on('click', '.pt-novel-del', function () {
            $(this).parents('li').remove();
        }).on('click', '.pt-mark-add', function () {
            pt_novel.removeClass('active');
            pt_marks.addClass('active');
            btn_next.hide();
        }).on('click', '.pt-search-add', function () {
            pt_novel.removeClass('active');
            pt_search.addClass('active');
            btn_next.hide();
            $('.btn-search').click();
        });

        //书籍添加页 点击事件
        $('.pt-marks,.pt-search').on('click', 'li', function () {
            var othis = $(this), num = 0;
            if (othis.hasClass('active')) {
                othis.removeClass('active');
                num = $(this).siblings(".active").length;
            } else {
                othis.addClass('active');
                num = $(this).siblings(".active").length + 1;
            }
            $(this).parents('.pt-popular-cont').find('.btn-success').find('span').html(num)
        }).on('click', 'button.bg-white', function () {
            btn_return.click();
        }).on('click', 'button.btn-success', function () {
            $(this).parents('.pt-popular-cont').find('li.active').each(function (l, v) {
                v = $(v);
                if (!pt_novel.find('input[name="novels[id][]"][value=' + v.data('id') + ']').length) {
                    laytpl($('#novelTpl').html()).render({
                        id: v.data('id'),
                        name: v.data('name'),
                        cover: v.data('cover'),
                        category: v.data('category'),
                        author: v.data('author'),
                        allvisit: v.data('allvisit')
                    }, function (html) {
                        pt_novel.find('ul').append(html);
                    });
                }
            });
            btn_return.click();
        });
        $('.btn-search').click(function () {
            $.ajax({
                url: '<?php echo \Kuxin\Helper\Url::build("novel.search.result",[],'json');?>',
                method: 'POST',
                data: {'searchkey':$('.pt-search input.searchkey').val()},
                dataType: 'json',
                beforeSend: function () {
                    $('body').append('<div class="loading"><div>')
                },
                success: function (res) {
                    if (res.code) {
                        alert(res.msg);
                    } else {
                        var ul = pt_search.find('ul');
                        ul.html('');
                        laytpl($('#searchTpl').html()).render(res.data, function (html) {
                            ul.append(html);
                        });
                    }
                },
                complete: function () {
                    $('body div.loading').remove();
                },
            });
        });
    </script>
</body>
</html>